#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "LED.h"
#include "Switch.h"
#include "Buzzer.h"
#include "Light.h"
#include "OLED.h"
// #include "Light_Interrput.h"
#include "NOLED.h"
#include "string.h"
#include "Timer.h"
#include "Pwm.h"
#include "Car.h"

static uint16_t cnt = 0;


int main(void)
{
	Car_Init();
	// Pwm_Init();
	Delay_s(2);

	
	while(1) 
	{
		Car_Foward();
		for (int i = 0; i < 5; i++)
		{
			Car_Speed_Up();
			Delay_s(1);
		}
		for (int i = 0; i < 4; i++)
		{
			Car_Turn_Left();
			Delay_s(1);
		}
		for (int i = 0; i < 2; i++)
		{
			Car_Turn_Right();
			Delay_s(1);
		}
		Car_Foward();

		for (int i = 0; i < 5; i++)
		{
			Car_Speed_Down();
			Delay_s(1);
		}
		// Pwm_setCompare1(50);
	}
}

void TIM2_IRQHandler(void)
{
	// judge interrupt flag
	if (TIM_GetITStatus(TIM2, TIM_IT_Update) == SET)
	{
		cnt++;
	// clear interrupt flag
		TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
	}

}
